//
//  HomepageNavBar.swift
//  zhihuifan
//
//  Created by apple on 2017/9/4.
//  Copyright © 2017年 youyou. All rights reserved.
//

import UIKit

class HomepageNavBar: UIView {
    //闭包回调
    var clickLocationCallBack:(()->())?
    @IBOutlet weak var arrowImageView: UIImageView!
    @IBOutlet weak var locationLabel: UILabel!
    @IBOutlet weak var qrcodeView: HomepageQRCodeView!
    @IBOutlet weak var searchView: SearchView!
    class func loadNib() -> HomepageNavBar{
        let nib = UINib(nibName: "HomepageNavBar", bundle: nil)
        guard let navbar =  nib.instantiate(withOwner: nil, options: [:])[0] as? HomepageNavBar else {
            return HomepageNavBar()
        }
        return navbar
    }
    override func awakeFromNib() {
        super.awakeFromNib()
        addTapGes()
    }
}
extension HomepageNavBar{
    fileprivate func addTapGes(){
        let tapges1 = UITapGestureRecognizer(target: self, action: #selector(tapAct))
        let tapges2 = UITapGestureRecognizer(target: self, action: #selector(tapAct))

        locationLabel.isUserInteractionEnabled = true
        arrowImageView.isUserInteractionEnabled = true
        locationLabel.addGestureRecognizer(tapges1)
        arrowImageView.addGestureRecognizer(tapges2)
    }
    @objc func tapAct(){
        
        clickLocationCallBack?()
    }
}
